import 'package:flutter/material.dart';
import 'package:flutter_music/pages/home/models/song.dart';
import 'package:flutter_music/utils/utils.dart';
import 'package:flutter_music/widgets/neu_box.dart';

class MusicCover extends StatelessWidget {
  final Song song;

  const MusicCover({
    super.key,
    required this.song,
  });

  @override
  Widget build(BuildContext context) {
    return NeuBox(
      child: Column(
        children: [
          /// 封面图片
          ClipRRect(
            borderRadius: BorderRadius.circular(8),
            child: Utils.loadImage(song.albumArtImageName ?? ''),
          ),

          /// 信息
          Padding(
            padding: const EdgeInsets.all(15.0),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                // song infos
                Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(
                      song.songName ?? '',
                      style: const TextStyle(
                        fontSize: 20,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    Text(song.artistName ?? ''),
                  ],
                ),
                // fav
                const Icon(
                  Icons.favorite,
                  color: Colors.red,
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
